<template>
  <div>
    <el-row>
      <el-col :span="8">
        <div class="grid-content bg-purple">&nbsp;</div>
      </el-col>
      <el-col :span="8">
        <div class="grid-content bg-purple-light">
          <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="方向名称">
              <el-input v-model="form.name"></el-input>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmit">保存</el-button>
            </el-form-item>
          </el-form>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="grid-content bg-purple"></div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        form: {
          name: ''
        }
      }
    },
    methods: {
      onSubmit() {
        this.$axios.post('college/save', this.form).then((res) => {
          console.log(res);
          if (res.data.code == 201) {
            this.$message.error(res.data.msg);
          } else {
            this.$message({
              message: '恭喜你，添加成功',
              type: 'success'
            });
            this.$router.push("College");
          }
        })
      }
    }
  }
</script>

<style>

</style>
